<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title>~설문설문~</title>
<link href="./css/form.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="./js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
	$('document').ready(function() {
		$.getJSON("get_location.php", function(data) {
			$.each(data.ap, function(ap, ap_info) {
				$('#location').append("<option value='" + ap_info.location + "'>" + ap_info.location + "</option>");
			});
		});
		
		var locationType = $('#location_type');
		locationType.change(function() {
			$.getJSON("get_location.php", function(data) {
				$('#location').empty();
				if (locationType.val() == "indoor") {
					$.each(data.ap, function(ap, ap_info) {
						$('#location').append("<option value='" + ap_info.location + "'>" + ap_info.location + "</option>");
					});
				}
				else {
					$.each(data.gps, function(gps, gps_info) {
						$('#location').append("<option value='" + gps_info.location + "'>" + gps_info.location + "</option>");
					});
				}
			});
		});
	});
	
	function processForm() {
		opener.location_query.value = $('#location').val();
		window.close();
	}
</script>
</head>
<body>
	<form id="location_cond_select" style="width: 400">
		<h1 style="padding-top: 0px; border-top: 0px;">위치를 선택해주세요</h1>
		<fieldset>
			<legend>위치선택</legend>
			<div>
				<label for="location" class="label">위치조건: </label>
				<select id="location_type">
					<option value="indoor">실내</option>
					<option value="outdoor">실외</option>
				</select>
				<select id="location" name="location">
				</select>
			</div>
		</fieldset>
		<div class="submit" style="margin: 0 auto; width: 100px">
			<input type="button" value="확인" onclick="processForm();">
		</div>
	</form>
</body>
</html>